package com.shop.entity;

// Generated 2015-10-7 22:59:34 by Hibernate Tools 4.0.0

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Promotion generated by hbm2java
 */
@Entity
@Table(name = "promotion", catalog = "shop")
public class Promotion implements java.io.Serializable {

	private Integer promId;
	private String promUuid;
	private String promType;
	private BigDecimal promDiscount;
	private BigDecimal promPrice;
	private Date promStartDate;
	private Date promDate;
	private Date promEndDate;
	private boolean promEnabled;
	private String promDesc;
	private Integer promLimitNum;
	private boolean promFlashSale;
	private Set<Product> products = new HashSet<Product>(0);

	public Promotion() {
	}

	public Promotion(String promUuid, String promType, Date promDate,
			boolean promEnabled, String promDesc, boolean promFlashSale) {
		this.promUuid = promUuid;
		this.promType = promType;
		this.promDate = promDate;
		this.promEnabled = promEnabled;
		this.promDesc = promDesc;
		this.promFlashSale = promFlashSale;
	}

	public Promotion(String promUuid, String promType, BigDecimal promDiscount,
			BigDecimal promPrice, Date promStartDate, Date promDate,
			Date promEndDate, boolean promEnabled, String promDesc,
			Integer promLimitNum, boolean promFlashSale, Set<Product> products) {
		this.promUuid = promUuid;
		this.promType = promType;
		this.promDiscount = promDiscount;
		this.promPrice = promPrice;
		this.promStartDate = promStartDate;
		this.promDate = promDate;
		this.promEndDate = promEndDate;
		this.promEnabled = promEnabled;
		this.promDesc = promDesc;
		this.promLimitNum = promLimitNum;
		this.promFlashSale = promFlashSale;
		this.products = products;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "prom_id", unique = true, nullable = false)
	public Integer getPromId() {
		return this.promId;
	}

	public void setPromId(Integer promId) {
		this.promId = promId;
	}

	@Column(name = "prom_uuid", nullable = false, length = 32)
	public String getPromUuid() {
		return this.promUuid;
	}

	public void setPromUuid(String promUuid) {
		this.promUuid = promUuid;
	}

	@Column(name = "prom_type", nullable = false, length = 8)
	public String getPromType() {
		return this.promType;
	}

	public void setPromType(String promType) {
		this.promType = promType;
	}

	@Column(name = "prom_discount", precision = 2)
	public BigDecimal getPromDiscount() {
		return this.promDiscount;
	}

	public void setPromDiscount(BigDecimal promDiscount) {
		this.promDiscount = promDiscount;
	}

	@Column(name = "prom_price", precision = 7)
	public BigDecimal getPromPrice() {
		return this.promPrice;
	}

	public void setPromPrice(BigDecimal promPrice) {
		this.promPrice = promPrice;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "prom_start_date", length = 19)
	public Date getPromStartDate() {
		return this.promStartDate;
	}

	public void setPromStartDate(Date promStartDate) {
		this.promStartDate = promStartDate;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "prom_date", nullable = false, length = 19)
	public Date getPromDate() {
		return this.promDate;
	}

	public void setPromDate(Date promDate) {
		this.promDate = promDate;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "prom_end_date", length = 19)
	public Date getPromEndDate() {
		return this.promEndDate;
	}

	public void setPromEndDate(Date promEndDate) {
		this.promEndDate = promEndDate;
	}

	@Column(name = "prom_enabled", nullable = false)
	public boolean isPromEnabled() {
		return this.promEnabled;
	}

	public void setPromEnabled(boolean promEnabled) {
		this.promEnabled = promEnabled;
	}

	@Column(name = "prom_desc", nullable = false)
	public String getPromDesc() {
		return this.promDesc;
	}

	public void setPromDesc(String promDesc) {
		this.promDesc = promDesc;
	}

	@Column(name = "prom_limit_num")
	public Integer getPromLimitNum() {
		return this.promLimitNum;
	}

	public void setPromLimitNum(Integer promLimitNum) {
		this.promLimitNum = promLimitNum;
	}

	@Column(name = "prom_flashSale", nullable = false)
	public boolean isPromFlashSale() {
		return this.promFlashSale;
	}

	public void setPromFlashSale(boolean promFlashSale) {
		this.promFlashSale = promFlashSale;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "promotion")
	public Set<Product> getProducts() {
		return this.products;
	}

	public void setProducts(Set<Product> products) {
		this.products = products;
	}

}
